package com.smag.web.controller.farming;

import com.smag.common.annotation.Anonymous;
import com.smag.common.core.controller.BaseController;

import com.smag.common.core.domain.entity.FarmTech;
import com.smag.common.core.page.TableDataInfo;
import com.smag.system.domain.vo.FarmIdentify;
import com.smag.system.service.FarmTechService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

import static com.smag.common.utils.PageUtils.startPage;

@Slf4j
@RestController
@RequestMapping("/farming/tech")
@Anonymous
public class FarmTechController extends BaseController {
    @Resource
    private FarmTechService farmTechService;
    @GetMapping("/list")
    public TableDataInfo pageListCrop(FarmTech farmTech){
        startPage();
        return getDataTable(farmTechService.pageListCrop(farmTech,null));
    }

    @PostMapping("/identify")
    public FarmIdentify identify(@RequestParam("file") MultipartFile file){
        log.info("图片接受成功");
        FarmIdentify result = farmTechService.identify(file);
        return result;
    }

}
